(* ::Package:: *)

SetDirectory["C:\\Documents and Settings\\ajm\\Desktop\\Chris\\branches\\HMC_core\\output"]


param=OpenRead["..\\input\\params_hmc.txt"];
Skip[param,{Number}];
Tstart=Read[param,Number];
Tstep=Read[param,Number];
Tend=Read[param,Number];
Pacc=Read[param,Number];
Nmd=Read[param,Number];
Nmc=Read[param,Number];
Skip[param,{Number}];
Nruns=Read[param,Number];
NumDim=Read[param,Number];

Close[param];

templist=Range[Tstart,Tend,Tstep];

funcname="ZfuncMolecule\\Cap\\CGM";


loadstring=".\\"<>funcname<>"\\CGM_Solution.out";

fid=OpenRead[loadstring];

Skip[fid,String];
Skip[fid,String];
Skip[fid,String];


nSuccess=0;
l={};
i=1;

For[iNruns=1,iNruns<=Nruns,iNruns++,
Skip[fid,Number];
x=Read[fid,Number];
Skip[fid,Number];
Skip[fid,Number];
y=Read[fid,Number];
Skip[fid,Number];

If[x<100.0,nSuccess++;l=Insert[l,{x,y},i];i++,Null];

Clear[x];
Clear[y];
];


Print["nSuccess = ",nSuccess];
Print["Success rate = ",N[(nSuccess/Nruns)*100],"%"];


l


Close[fid];
